package com.demo0_求激光切割的块数;

//定义一条边的对象
public class Edge {
    int startX;
    int startY;
    int endX;
    int endY;
    int status; //是否被切割, 0代表未切割,1 代表切割

    public Edge() {
    }

    public Edge(int startX, int startY, int endX, int endY, int status) {
        this.startX = startX;
        this.startY = startY;
        this.endX = endX;
        this.endY = endY;
        this.status = status;
    }

    //判断是否是同一条边.
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Edge edge = (Edge) o;

        if(startX==edge.startX&&startY==edge.startY&&endX==edge.endX&&endY==edge.endY&&status==edge.status)
            return true;
        if(startX==edge.endX&&startY==edge.endY&&endX==edge.startX&&endY==edge.startY&&status==edge.status)
            return true;

       return false;
    }

    @Override
    public int hashCode() {
        int result = startX;
        result = 31 * result + startY;
        result = 31 * result + endX;
        result = 31 * result + endY;
        result = 31 * result + status;
        return result;
    }

    @Override
    public String toString() {
        return "Edge{" +"("+startX+","+startY+")"+","+"("+endX+","+endY+")"+"状态:"+status+'}';
    }

    public int getStartX() {
        return startX;
    }

    public void setStartX(int startX) {
        this.startX = startX;
    }

    public int getStartY() {
        return startY;
    }

    public void setStartY(int startY) {
        this.startY = startY;
    }

    public int getEndX() {
        return endX;
    }

    public void setEndX(int endX) {
        this.endX = endX;
    }

    public int getEndY() {
        return endY;
    }

    public void setEndY(int endY) {
        this.endY = endY;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }
}
